package org.codeart.common.util;

public class RedisPrefixUtil {

    // 乘客验证码前缀
    private static final String VERIFY_CODE_PREFIX = "verify-code:";

    private static final String TOKEN_PREFIX = "token:";

    /**
     * 黑名单key前缀
     */
    public static final String BLACK_DEVICE_PREFIX = "black-device:";

    /**
     * 根据手机号，生成key
     * @param phone    手机号
     * @param identity 标识
     * @return key
     */
    public static String generateKey(String phone, String identity) {
        return VERIFY_CODE_PREFIX + identity + ":" + phone;
    }

    /**
     * 根据手机号和身份标识生成token
     * @param phone
     * @param identity
     * @return
     */
    public static String generateTokenKey(String phone, String identity, String tokenType) {
        return TOKEN_PREFIX + phone + ":" + identity + ":" + tokenType;
    }
}
